package com.kakarote.admin.service.impl;

import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.kakarote.admin.entity.PO.AdminFeedback;
import com.kakarote.admin.mapper.AdminFeedbackMapper;
import com.kakarote.admin.service.IAdminFeedbackService;
import com.kakarote.core.servlet.BaseServiceImpl;
import com.kakarote.core.utils.UserUtil;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 提供反馈 服务实现类
 * </p>
 *
 * @author zhangzhiwei
 * @since 2021-11-16
 */
@Service
public class AdminFeedbackServiceImpl extends BaseServiceImpl<AdminFeedbackMapper, AdminFeedback> implements IAdminFeedbackService {

    @Override
    public void addFeedback(AdminFeedback adminFeedback) {
        adminFeedback.setCreateUserId(UserUtil.getUserId());
        adminFeedback.setCreateTime(LocalDateTimeUtil.now());
        String batchId = StrUtil.isNotEmpty(adminFeedback.getBatchId()) ? adminFeedback.getBatchId() : IdUtil.simpleUUID();
        adminFeedback.setBatchId(batchId);
        save(adminFeedback);
    }
}
